def method(nums): 
    d = {} # <num:count>
    s = [] # <index>
    for i, n in enumerate(nums):
        if n > len(nums):
            s.append(i + 1)  # 位置从1开始
        # [1,len]中每个数只要一个
        elif n not in d:
            d[n] = 1
        else:
            s.append(i + 1)
    # print(d)
    # print(s)
    ans = []
    for n in range(1, len(nums) + 1):
        if n not in d:
            index = s.pop()
            ans.append([index, n])
    return ans 

_ = int(input())
nums = [int(x) for x in input().split()]
ans = method(nums)
print(len(ans))
for an in ans:
    print(an[0], an[1])
    